import Mock from 'mockjs';
import system from '../data/system.js';
import user from '../data/user.js';
import role from '../data/role.js';
import permission from '../data/permission.js';
import runtime_config from "./config";
import dict from "../data/dict.js";
import dept from "../data/dept.js";
import emp from '../data/emp.js';
import client from '../data/client.js';

import store from '../data/a/store.js';
import room from '../data/a/room.js';
import dz from '../data/a/dz.js';
import jl from '../data/a/jl.js';
import kc from '../data/a/kc.js';
import yyjl from '../data/a/yyjl.js';
import kctp from '../data/a/kctp.js';
import dztkjl from '../data/a/dztkjl.js';
import jltkjl from '../data/a/jltkjl.js';
import bm from '../data/a/bm.js';
import skjl from '../data/a/skjl.js';
import hylx from '../data/a/hylx.js';
import hy from '../data/a/hy.js';
import fzjl from '../data/a/fzjl.js';
import settings from '../data/a/settings.js';
let baseURL = runtime_config[process.env.NODE_ENV].path;

let businessDataArray = [
	system, user, role, permission,dept,emp,dict, client,
	store, room, dz, jl, kc, yyjl, kctp, dztkjl, jltkjl, bm, 
	hylx, hy, skjl, fzjl,settings
];

for (let index in businessDataArray) {
	let itemDataArray = businessDataArray[index];
	for (let jndex in itemDataArray) {
		let dataObject = itemDataArray[jndex];
		
		Mock.mock(baseURL+dataObject.key, dataObject.method, () => {
			if ("function" === typeof dataObject.data) {
				return dataObject.data();
			}
			return dataObject.data;
		});
	}
}